package com.itheima.mapper;

import com.itheima.domain.Orders;
import com.itheima.domain.User;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface OrdersMapper {

    @Select("select * from orders")
    @Results({
        @Result(id=true,column = "id",property = "id"),
        @Result(column = "number",property = "number"),
        @Result(column = "user_id",property = "user",
                javaType = User.class,
                one = @One(select = "com.itheima.mapper.UserMapper.findById")
        )
    })
    List<Orders> findAll();
}
